import up from '@/assets/common/up.png'
import down from '@/assets/common/down.png'
import './TrendNum.css'
import CountUp from 'react-countup'

const TrendNum = ({ label, value, decimals, suffix }: { label: string; value: number; decimals?: number; suffix?: string }) => {
  return (
    <div className="trend-num">
      <span>{label}</span>
      {value !== 0 ? <img src={value > 0 ? up : down} alt={value > 0 ? 'up' : 'down'} /> : null}
      <CountUp end={Math.abs(value)} separator="," decimals={decimals} suffix={suffix} />
    </div>
  )
}

export default TrendNum
